﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Payroll.BusinessLogic.Company;
using Payroll.BusinessLogic;
using Payroll.Common.Utils;

namespace PayrollHR.Administration.Modules
{
    public partial class CompanyInfo : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }
        public int MyCompanyId
        {
            get
            {
                return CommonHelper.QueryStringInt("MyCompanyID");
            }
        }
        public void BindCompany(Payroll.BusinessLogic.Company.MyCompany com)
        {
            txtComName.Text = com.Name;
            txtAdress.Text = com.Address;
            txtComEmail.Text = com.EmailSend;
            txtTaxcode.Text = com.TaxCode;
            txtRecive.Text = com.Receive;
            txtEmailSender.Text = com.EmailSender;
            
        }
        public Payroll.BusinessLogic.Company.MyCompany GetCompany()
        {

            int UserId = PayrollContext.Current.Session.EmployeeId;

            Payroll.BusinessLogic.Company.MyCompany company = new Payroll.BusinessLogic.Company.MyCompany {
                MyCompanyID = this.MyCompanyId > 0 ? this.MyCompanyId : 0,
                Name=txtComName.Text,
                Address=txtAdress.Text,
                EmailSend=txtComEmail.Text,
                TaxCode=txtTaxcode.Text,
                Receive=txtRecive.Text,
                Createby=UserId,
                Modified=UserId,
                CreateDate=DateTime.Now,
                ModifiedDate=DateTime.Now,
                EmailSender= txtEmailSender.Text,
            };
            return company;
        }
    }
}